var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var Site = /** @class */ (function () {
    function Site() {
        this.num_val = 13;
    }
    Site.prototype.name = function () {
        console.log("hi");
    };
    Site.savl = 10;
    return Site;
}());
var site = new Site();
site.name();
var arr = [1, 2];
//可存储各种类型的数组
var arrayList = [1, false, "hello"];
//枚举
var Color;
(function (Color) {
    Color[Color["Red"] = 0] = "Red";
    Color[Color["Green"] = 1] = "Green";
    Color[Color["Blue"] = 2] = "Blue";
})(Color || (Color = {}));
;
//感觉很像 interface
var C = Color.Blue;
console.log(C);
console.log(Color);
var num;
//定义返回值类型
function test(msg) {
    console.log("I am test.");
    throw new Error(msg);
}
//无法被执行 到终点的方法
function loop() {
    while (true) {
    }
    ;
}
var getValue = function () {
    return 0;
};
var List;
(function (List) {
    List[List["A"] = getValue()] = "A";
    List[List["B"] = 3] = "B";
    List[List["C"] = 4] = "C";
})(List || (List = {}));
console.log(List);
console.log(List.A);
console.log(List.B);
console.log(List.C);
var type = 1;
type = "22";
console.log("any:");
console.log(type);
function buildName(firstName) {
    var restOfName = [];
    for (var _i = 1; _i < arguments.length; _i++) {
        restOfName[_i - 1] = arguments[_i];
    }
    return firstName + " " + restOfName.join(" ");
}
var employeeName = buildName("Joseph", "Samuel", "Lucas", "MacKinzie");
console.log("employeeName: " + employeeName);
function addNumbers() {
    var nums = [];
    for (var _i = 0; _i < arguments.length; _i++) {
        nums[_i] = arguments[_i];
    }
    var i;
    var sum = 0;
    for (i = 0; i < nums.length; i++) {
        sum = sum + nums[i];
    }
    console.log("\u548C\u4E3A:" + sum);
}
addNumbers(1, 2, 3); //6
addNumbers(10, 10, 10, 10, 10); //50
var myFunc = new Function("a", "b", "return a*b;");
console.log(myFunc);
var foo = function (x) { return 10 + x; };
function disp(x, y) {
    console.log(NaN);
    console.log("\u8F93\u51FA\u4E86:" + x + "," + y);
}
// function disp(x:number, y:number):void{
//     console.log(`x+y,输出了:${x+y}`);
// }
disp('hello');
disp(10, 'world');
var drummer = {};
drummer.age = 27;
drummer.instrument = "Drums";
console.log("\u5E74\u9F84\uFF1A" + drummer.age);
console.log("\u559C\u6B22\u7684\u4E50\u5668: " + drummer.instrument);
var customer = {
    age: 30,
    firstName: "Tom",
    lastName: "Hanks",
    sayHi: function () {
        return "Hi there";
    }
};
console.log("Customer 对象 ");
console.log(customer.firstName);
console.log(customer.lastName);
console.log(customer.sayHi());
var Iobj = { v1: 12, v2: 23 };
console.log("value 1: " + Iobj.v1 + ",  " + Iobj.v2);
//类
var Car = /** @class */ (function () {
    function Car(engine) {
        this.engine = "hello"; //原型属性
        this.engine = engine;
    }
    Car.prototype.disp = function () {
        console.log("\u53D1\u52A8\u673A\u4E3A\uFF1A" + this.engine);
    };
    return Car;
}());
var car = new Car("马自达");
console.log("Car \u7684\u5B9E\u4F8B\u5C5E\u6027\uFF1A" + car.engine);
console.log(car);
// console.log(`Car 的原型属性：${car.__proto__.engine}`);
//类的继承
var Shape = /** @class */ (function () {
    function Shape(a) {
        this.Area = a;
    }
    return Shape;
}());
//继承就是复制实例、原型属性和方法，子类原型指向父类原型
var Circle = /** @class */ (function (_super) {
    __extends(Circle, _super);
    function Circle() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Circle.prototype.disp = function () {
        console.log("\u5706\u7684\u9762\u79EF\uFF1A" + this.Area);
    };
    Circle.radius = 10;
    return Circle;
}(Shape));
var obj = new Circle(223);
obj.disp();
var Encapsulate = /** @class */ (function () {
    function Encapsulate() {
        this.str1 = "hello";
        this.str2 = "world";
    }
    return Encapsulate;
}());
var obj1 = new Encapsulate();
console.log(obj1.str1);
// console.log(obj1.str2);
//对象
var sites = {
    site1: "Runoob",
    site2: "Google",
    sayHello: function () {
        console.log("hello " + sites.site1);
    }
};
// sites.sayHello = function(){
//     console.log(`hello ${sites.site1}`);
// }
sites.sayHello();
